using System;
using System.Diagnostics.CodeAnalysis;
using RGuang.PlathformCtrl.FSM;
using UnityEngine;
using UnityEngine.Assertions;

namespace RGuang.PlathformCtrl
{
    public class PlayerStateMachine : StateMachine
    {
        [SerializeField] PlayerState[] m_state;
        Animator animator;
        PlayerInput input;
        PlayerController player;

        private void Awake()
        {
            animator = GetComponentInChildren<Animator>();
            input = GetComponent<PlayerInput>();
            player = GetComponent<PlayerController>();
            stateTabe = new System.Collections.Generic.Dictionary<System.Type, IState>(m_state.Length);
            foreach (PlayerState item in m_state)
            {
                item.Initialize(player,animator,input, this);
                stateTabe.Add(item.GetType(), item);
            }


        }

        private void Start()
        {
            SwitchOn(stateTabe[typeof(PlayerState_Idle)]);

        }



    }

}
